//-----------------------------------------------------------------------
// <copyright file="CompanyAndCertificateService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class CompanyAndCertificateService
    {
        #region CompanyAndCertificate

        public static void CreateCompanyAndCertificate(CompanyAndCertificate companyAndCertificate)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                companyAndCertificateDAO.CreateCompanyAndCertificate(companyAndCertificate);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateCompanyAndCertificateException, ex);
            }
        }        

        public static void UpdateCompanyAndCertificate(CompanyAndCertificate companyAndCertificate)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                companyAndCertificateDAO.UpdateCompanyAndCertificate(companyAndCertificate);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateCompanyAndCertificateException, ex);
            }
        }        

        public static void DeleteCompanyAndCertificate(int comAndCerID)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                companyAndCertificateDAO.DeleteCompanyAndCertificate(comAndCerID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteCompanyAndCertificateException, ex);
            }
        }
        
        public static CompanyAndCertificate GetCompanyAndCertificate(int comAndCerID)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                return companyAndCertificateDAO.GetCompanyAndCertificate(comAndCerID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndCertificateException, ex);
            }
        }                

        public static CompanyAndCertificateCollection GetCompanyAndCertificateList(CompanyAndCertificateColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                return companyAndCertificateDAO.GetCompanyAndCertificateList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndCertificateListException, ex);
            }
        }        

        public static CompanyAndCertificateCollection GetCompanyAndCertificateList(CompanyAndCertificateColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                return companyAndCertificateDAO.GetCompanyAndCertificateList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndCertificateListException, ex);
            }
        }        

	    public static CompanyAndCertificateCollection GetCompanyAndCertificateListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                return companyAndCertificateDAO.GetCompanyAndCertificateListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndCertificateListException, ex);
            }
        }        

        public static CompanyAndCertificateCollection GetCompanyAndCertificateListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                CompanyAndCertificateDAO companyAndCertificateDAO = new CompanyAndCertificateDAO();
                return companyAndCertificateDAO.GetCompanyAndCertificateListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndCertificateListException, ex);
            }
        }        

        #endregion
    }
}